package cn.com.dcsgo.domain.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.LinkedList;
import java.util.List;

/**
 * 路由 视图对象
 *
 * @author Dcsgo
 * @since 3/6/2025 上午 11:52
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
@Schema(description = "路由 视图对象")
public class RouterVO {
    /**
     * 路由地址
     */
    @Schema(description = "路由地址")
    private String path;

    /**
     * 路由名
     */
    @Schema(description = "路由名")
    private String name;

    /**
     * 组件
     */
    @Schema(description = "组件")
    private String component;

    /**
     * 是否总是显示
     */
    @Schema(description = "是否总是显示")
    private Boolean alwaysShow;

    /**
     * 是否隐藏
     */
    @Schema(description = "是否隐藏")
    private Boolean hidden;

    /**
     * 路由重定向
     */
    @Schema(description = "路由重定向")
    private String redirect;

    /**
     * 元数据
     */
    @Schema(description = "元数据")
    private Meta meta;

    /**
     * 子路由
     */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    @Schema(description = "子路由")
    private List<RouterVO> children;

    public RouterVO() {
        this.children = new LinkedList<>();
        this.meta = new Meta();
    }

    @Data
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @Schema(description = "路由元数据")
    @NoArgsConstructor
    public static final class Meta {
        /**
         * 标题
         */
        @Schema(description = "标题")
        private String title;

        /**
         * 图标
         */
        @Schema(description = "图标")
        private String icon;

        /**
         * 前缀
         */
        @Schema(description = "前缀")
        private String affix;

        /**
         * 不缓存
         */
        @Schema(description = "不缓存")
        private Boolean noCache;
    }
}
